﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CongregacaoOs.Data;

namespace CongregacaoOs.Business
{
    [System.ComponentModel.DataObject]
    public class ccReports : IDisposable
    {
        private CcbOrdemServico db;

        public void Dispose() { }

        public ccReports()
        {
            this.db = new CcbOrdemServico();
        }

        public List<GetStatistics1_Result> GetStatistics(int KindOf) /*1=ANDAMENTO, 2=CONCLUIDA, 3=AGUARDANDO*/
        {
            try
            {
                System.Data.Objects.ObjectResult<GetStatistics1_Result> result = db.GetStatistics1(KindOf);
                List<GetStatistics1_Result> sqlResult = new List<GetStatistics1_Result>();
                GetStatistics1_Result NewItem;

                foreach (GetStatistics1_Result item in result)
                {
                    NewItem = new GetStatistics1_Result();

                    NewItem.admOut = item.admOut;
                    NewItem.qtd = item.qtd;

                    sqlResult.Add(NewItem);
                }
                return sqlResult;
            }
            catch (Exception erro)
            {
                throw new Exception("Message:" + erro.Message);
            }

        }
    }
}
